<!doctype html>
<html>
<head>

	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width,user-scalable=no, initial-scale=1">
	<link rel="stylesheet" href="css/index.css" type="text/css">
	<link rel="stylesheet" href="css/zy.css" type="text/css">
	<link rel="stylesheet" href="css/swiper.min.css" type="text/css">
	<script type="text/javascript" src="js/swiper.min.js"></script>
	<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
	<script src="/js/common.js"></script>
	<script src="/js/plugins/jrender/jrender.js"></script>

</head>
<body>

<!--页面内容
<div id="yemnr">-->
<!--头部-->
<div class="toub_beij toub_beij_zy">
	<div class="zhongj_k zhongj_k_z">
		<div class="jiu_feo">
			<div class="logo_k logo_k_fanh"><a href="/mine/profiles.html"><img class="fanh_ann" src="images/web/fanh.png"></a></div>
			<div class="zhongjain_daoh">
				<ul>
					<li><a class="zyyge" style="font-size:20px">我的收藏</a></li>
				</ul>
			</div>
		</div>

	</div>

<!--内容-->
<div class="jif_kuang">
	<ul class="jif_daoh">
		<li ><a href="/shopping/我的收藏.html">日报列表</a><i></i></li>
		<li class="no"><a >游记列表</a><i></i></li>

	</ul>
	<div class="shouru_mxi">
		<h1 class="jifenshouru_biaot" style="font-size:20px" align="center">世界这么大,我想去看看</h1>
		<ul class="ul_mx" render-loop="list">
			<li>
				<a href="" render-key="list.id" render-fun="handle">
					<h1><img render-src="list.coverUrl"></h1>
					<div class="zhong_wenz">
						<p render-html="list.title" style="font-size:20px"></p>
						<span render-html="list.lastUpdateTime" style="font-size:20px"></span>
					</div>
				</a>
				<button class=" btn-danger btn-xs btn-delete" style="width:33px; height:30px; background-color: #d32dff " render-value="list.id">删除</button>
			</li>
		</ul>
	</div>
	<div class="jiazz">
		<p class="px22">我是都底线的...</p>
	</div>
</div>

</body>
</html>

<script>
	$(function () {

        var dailys;
        var currentPage = 1;
        var pages;

        var user = getUser();
        $.get("/users/"+user.id+"/travel/collect",function (data) {

            dailys = data.list;
            pages = data.pages;
            renderVal(data);


            $(".btn-delete").click(function () {
                var dailyId= $(this).val();
                console.log(dailyId);
                var userId = getUser().id;
                $.ajax({
                    type: "POST",
                    url: "/users/travel/collect",
                    //data: "_method=DELETE&dailyId="+dailyId+"&userId="+userId+"",
                    data:{_method:"DELETE",travelId:dailyId,userId:userId},
                    success: function(msg){
                        window.location.reload();
                    }
                });
            })
        })

        $(window).scroll(function () {
            if (isFull()) {
                if (currentPage < pages) {

                    $.get("/users/"+user.id+"/travel/collect", {currentPage: ++currentPage}, function (data) {
                        $.merge(dailys, data.list);
                        renderVal({list: dailys});
                    })
                } else {

                }
            }

        })

        function renderVal(data) {
            $(".shouru_mxi").renderValues(data,{
                handle:function (ele,val) {
                    ele.href = "/travelContent.html?id=" + val;
                }
            });
        }

    })
</script>

</body>
</html>
